/**
 * Created by zhaocong on 2016/7/12.
 * 用户管理
 */
define(['jquery', 'timepicker'], function (require, exports, module) {
  "use strict";
  var cc = window.cc || {};
  cc.Customer = function () {
    var self = this;

    self.bindEvents = function () {
      /* 删除修改客户 */
      $('.checkboxes,#checkall').change(function () {
        var len = $('.checkboxes:checked').length;
        $('#custorEdit').prop('disabled', len != 1);
        $('#custorDel').prop('disabled', len < 1);
      });

      /* 添加新的客户 */
      $('#custorAddBtn').click(self.custorAdd);
    };


    /**
     * 添加新客户
     */
    self.custorAdd = function () {
      $('#custorAddModal').modal();
    };

    /**
     * 时间选择
     */
    self.datatime = function () {
      $('.form_datetime').datetimepicker({
        language: 'zh-CN',
        weekStart: 1,
        todayBtn: 1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 4,
        forceParse: 0,
        showMeridian: 1,
        minView: 2,
        format: "yyyy-mm-dd"
      });
    };

    /**
     * 默认方法
     * @private
     */
    self._init = (function () {
      self.bindEvents();
      self.datatime();
      
    })();
  }

  module.exports = cc.Customer();
});